package com.controller.reqdto;

import com.enums.CommonEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @author: Ruiwen
 * @DATE: 2024/10/29
 * @PROJECT_NAME: bdt_control
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class InstructParam {
    /**
     * 指令ID
     */
    @ApiModelProperty(value = "群组ID/单个ID/")
    private Integer id;

    /**
     * 指令类型（0开启 1、关闭）
     */
    @ApiModelProperty(value = "指令类型（0开启 1、关闭）")
    private Integer instructType;

    /**
     * 参数类型     0：群组  1：单个   2：批量
     */

    @ApiModelProperty(value = " 0：群组  1：单个   2：批量）")
    private Integer paramType = 0;

    /**
     * 宿主机ID
     */
    @ApiModelProperty(value = "宿主机IDS）")
    private List<Integer> idList;


    public String getMsg() {
        if (instructType == 0) {
            return "open";
        } else {
            return "close";
        }
    }

    public Integer getGroupStatus() {
        if (instructType == 0) {
            return CommonEnum.GROUP_RUNNING.getCode();
        } else {
            return CommonEnum.GROUP_STOP.getCode();
        }
    }

    public Boolean isOpen() {
        return instructType == 0;
    }
}
